layout.tsx 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import clsx from "clsx";
  2. import { Metadata, Viewport } from "next";
  3. import { NextIntlClientProvider } from "next-intl";
  4. import { getMessages } from "next-intl/server";
  5. import { Inter as FontSans } from "next/font/google";
  6. import { ReactNode } from "react";
  7. import "../globals.scss";
  8. import { Providers } from "./providers";
  9. // 加载字体
  10. const fontSans = FontSans({
  11. subsets: ["latin"],
  12. variable: "--font-sans",
  13. });
  14. export const viewport: Viewport = {};
  15. export const metadata: Metadata = {
  16. title: {
  17. template: " %s | BCWin777",
  18. default: "BCWin777",
  19. },
  20. keywords: ["BCWin777"],
  21. description: "The home of over 30 million players",
  22. appleWebApp: {
  23. statusBarStyle: "black",
  24. },
  25. formatDetection: {
  26. email: false,
  27. address: false,
  28. telephone: false,
  29. },
  30. referrer: "no-referrer",
  31. other: {
  32. viewport: [
  33. "width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0," +
  34. " viewport-fit=cover ",
  35. ],
  36. },
  37. };
  38. export default async function LocaleLayout({
  39. children,
  40. params: { locale },
  41. }: {
  42. children: ReactNode;
  43. params: { locale: string };
  44. }) {
  45. const messages = await getMessages();
  46. return (
  47. <html lang={locale} suppressHydrationWarning>
  48. <body className={clsx("font-sans", fontSans.variable)}>
  49. <NextIntlClientProvider messages={messages}>
  50. <Providers themeProps={{ attribute: "class" }}>{children}</Providers>
  51. </NextIntlClientProvider>
  52. </body>
  53. </html>
  54. );
  55. }